package com.gjzt.business.customer.controller;

import net.sf.json.JSONObject;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.eastdigit.servlet.RequestAttribute;
import com.eastdigit.servlet.Response;
import com.eastdigit.servlet.ReqBean;
import com.gjzt.business.customer.service.CustomerResourceService;

@Controller
@RequestMapping(value = "/adCustomerResource")
public class CustomerResourceController {

    @Autowired
    private CustomerResourceService customerResourceService;

    /**
     * 查询
     *
     * @param reqBean
     * @return
     */
    @RequestMapping(value = "/query")
    @ResponseBody
    public JSONObject queryAdCustomerResource(final @RequestAttribute(ReqBean.NAME) ReqBean reqBean) {
        return Response.response(customerResourceService.findAdCustomerResource(reqBean));
    }

    /**
     * 添加
     *
     * @param reqBean
     * @return
     */
    @RequestMapping(value = "/add")
    @ResponseBody
    public JSONObject addAdCustomerResource(final @RequestAttribute(ReqBean.NAME) ReqBean reqBean) {
        customerResourceService.addAdCustomerResource(reqBean);
        return Response.responseSuccess();
    }

    /**
     * 修改
     *
     * @param reqBean
     * @return
     */
    @RequestMapping(value = "/update")
    @ResponseBody
    public JSONObject updateAdCustomerResource(final @RequestAttribute(ReqBean.NAME) ReqBean reqBean) {
        customerResourceService.updateAdCustomerResource(reqBean);
        return Response.responseSuccess();
    }

    /**
     * 删除
     *
     * @param reqBean
     * @return
     */
    @RequestMapping(value = "/delete")
    @ResponseBody
    public JSONObject removeAdCustomerResource(final @RequestAttribute(ReqBean.NAME) ReqBean reqBean) {
        customerResourceService.removeAdCustomerResource(reqBean);
        return Response.responseSuccess();
    }

    //TODO 其他功能
}